package com.zjitc.controller;

import org.omg.CORBA.Request;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.InternalResourceView;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/19 14:18
 * @description:
 */
@Controller
public class HelloController {


  @RequestMapping("/handler")
  @ResponseBody
  public String handler(){
    System.out.println("hello world");
    return "hello world handler";
  }


  @RequestMapping("/location")
  public ModelAndView location(){
    ModelAndView mv = new ModelAndView();
    mv.setViewName("/data.jsp");

    //mv.addObject("name","maoyongqi");
    //mv.addObject("age","18");

    ModelMap map = new ModelMap();
    map.addAttribute("name","maoyongqi");
    map.addAttribute("age","18");

    mv.addAllObjects(map);
    return mv;
  }
}
